package com.enzo.prms.common.base.dao;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.hibernate.criterion.DetachedCriteria;

import com.enzo.prms.common.base.to.BaseEntity;
import com.enzo.prms.common.exception.base.DAOException;

public interface BaseDAO<T extends BaseEntity> extends ExecutableDao {

	public void save(T obj);

	public void update(T obj) throws DAOException;

	public void delete(T obj);

	public void delete(Integer id);
	
	public void delete(Collection<T> entities);

	public T getById(Integer id);

	public T load(Integer id);
	
	public void executeByHql(final String hql,final Map<String, Object> params)throws DAOException;
	
	public List<T> getListByCriteria(final DetachedCriteria criteria) throws DAOException;

	public List<T> getListForPage(final String sql,
			final Map<String, Object> params, final int offset, final int length);

	public long count(final String sql);

	public List<T> getListByHQL(final String hql,
			final Map<String, Object> params);

	public List<T> getListBySQL(final String sql,
			final Map<String, Object> params);

	public List<T> getListByNamedSQL(final String sqlName,
			final Map<String, Object> params);

}